package learning.designpatterns.builder.vehicle;

import java.util.HashMap;
import java.util.Map;

public class Vehicle {
    private VehicleType vehicleType;

    private Map<String, String> vehicleParts = new HashMap<String, String>();

    public Vehicle(VehicleType vehicleType) {
        this.vehicleType = vehicleType;
    }

    public void addPart(String partName, String partValue) {
        this.vehicleParts.put(partName, partValue);
    }

    @Override
    public String toString() {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("Vehicle{" +
                "vehicleType=" + vehicleType);

        stringBuilder.append("Vehicle parts: ");

        for (String s : vehicleParts.keySet()) {
            stringBuilder.append(s + " = " + vehicleParts.get(s));
        }

        stringBuilder.append("}");


        return stringBuilder.toString();
    }
}
